<?php
/**
 * Language Controller
 *
 * @author     Olivier Parent
 * @copyright  Copyright (c) 2011 Artevelde University College Ghent
 */
class LanguageController extends Zend_Controller_Action
{

    public function init()
    {
        $this->_helper->layout()->disableLayout(); // Layout uitschakelen
        $this->_helper->viewRenderer->setNoRender(true);
    }

    public function indexAction()
    {
        $this->_helper->redirector('set', 'language');
    }

    public function setAction()
    {
        $session_language = new Zend_Session_Namespace('language');
        
        $session_language->lang = $this->getRequest()
                                       ->getParam('lang');

        $session_history = new Zend_Session_Namespace('history');
        if ( isset ($session_history->prevUri) ) {
            $this->_helper->redirector
                          ->setPrependBase(false)
                          ->gotoUrl($session_history->prevUri);
            
        } else {
            $this->_helper->redirector('index', 'index');
        }
    }

}
